#ifndef LUABLOCK_H
#define LUABLOCK_H

#include <QVector>
#include <QString>

enum LuaBlockTypeEnum
{
    ELuaTypeGenericBlock = 0,
    ELuaTypeChunk,
    ELuaTypeElseIf,
    ELuaTypeElse,
    ELuaTypeExpression,
    ELuaTypeFieldSelector,
    ELuaTypeFor,
    ELuaTypeBody,
    ELuaTypeForList,
    ELuaTypeForNumeric,
    ELuaTypeFunction,
    ELuaTypeFunctionName,
    ELuaTypeIf,
    ELuaTypeIfThen,
    ELuaTypeLocalFunction,
    ELuaTypeLocalVariableDeclaration,
    ELuaTypeParameters,
    ELuaTypeRepeat,
    ELuaTypeStatement,
    ELuaTypeWhile,
    ELuaTypeDoWhile,
    ELuaTypeAssignment,
    ELuaTypeGlobalVariable,
    ELuaTypeLocalVariable,
    ELuaTypeForBody,
    ELuaTypeConstructor,
    ELuaTypePrimaryExpression
};


class LuaBlock
{
protected:
    LuaBlockTypeEnum m_type;
    QVector<LuaBlock *> m_blocks;
    LuaBlock * m_parent;
    int m_offset;
    int m_length;
    QString m_name;
public:
    LuaBlock();
    virtual ~LuaBlock();
    LuaBlockTypeEnum getType();
    void addBlock(LuaBlock * aBlock);
    virtual void print(int aIndent);
    void setParent(LuaBlock *aParent);
    LuaBlock * getParent();
    int getOffset();
    void setLength(int aLength);
    int getLength();
    QVector<LuaBlock *> & getBlocks();
    void setType(LuaBlockTypeEnum aType);
    static QString getTypeLine(LuaBlockTypeEnum aType);
    void setOffset(int aOffset);
    QString getName();
    void setName(QString aName);
    LuaBlock * getEnclosingBlock(int aOffset);
};

#endif // LUABLOCK_H
